package com.manshu.manshuweb.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@ControllerAdvice
@Slf4j
public class MyException {
    @ExceptionHandler(java.lang.ArithmeticException.class)
    @ResponseBody
    public String lalala(HttpServletRequest request, HttpServletResponse response,Exception e){
        return "我是全局异常捕获小能手,"+e;
    }

}
